<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ request.getContextPath() + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<title>Insert title here</title>
</head>
<body>
<%//调用 getParameter 之前，设置请求的字符集解决post的中文
		//如表单提交方法是 get，中文问题由 server.xml 中的URIEncoding解决
		request.setCharacterEncoding("UTF-8");
		String username = request.getParameter("username");
		String[] favorites=request.getParameterValues("favorite");

	%>
	<%=username%>
	<%
		for(String favorite:favorites){
			out.print(favorite+" ");
		}
	%>
</body>
</html>